<?php
/**
 * UrlPost.php
 *
 * @category    Madoqua
 * @package     View
 * @subpackage  Helper
 */

/** base class */
require_once 'Madoqua/View/Helper/Abstract.php';

/**
 * Madoqua_View_Helper_UrlPost
 *
 * generate url to a post
 *
 * @category    Madoqua
 * @package     View
 * @subpackage  Helper
 */
class Madoqua_View_Helper_UrlPost extends Madoqua_View_Helper_Abstract
{
    /**
     * generate url to the root of the site
     *
     * @param object|array|string $post
     * @return string
     */
    public function urlPost($post)
    {
        if (is_object($post)) {
            $slug = $post->slug;
        } elseif (is_array($post)) {
            $slug = $post['slug'];
        } else {
            $slug = $post;
        }

        return $this->url(array('slug' => $slug), 'post_read', true);
    }
}